html, body {
  height: 100%;
  margin: 0;
  font-family: 'Quicksand', sans-serif;
  scroll-behavior: smooth;
  transition: background-color 0.3s, color 0.3s;
}

#wheel-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 150px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Ensure the wheel column centers the wheel on wide and narrow screens */
.container-fluid > .row > .col-md-8 {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#wheelCanvas {
  cursor: pointer;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#pointer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 40px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: #1E90FF;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
  z-index: 10;
  transition: transform 0.2s ease;
}

#pointer:hover {
  transform: translateX(-50%) scale(1.1);
}

#overlayButton {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  z-index: 20;
  display: none;
  animation: bounce 1.5s infinite;
}

#emptyWheelOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: bold;
  z-index: 30;
  display: none;
  border-radius: 10px;
  pointer-events: none;
  white-space: nowrap;
}

#winnerOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 24px;
  font-weight: bold;
  color: white;
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 20;
  display: none;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-10px); }
}

.navbar-custom {
  background: linear-gradient(90deg, #1E90FF, #00BFFF);
}

.navbar-custom .navbar-brand, .navbar-custom .nav-link {
  color: #fff !important;
}

.btn-primary {
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  border: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: scale(1.05);
}

.btn-primary.loading {
  opacity: 0.7;
  pointer-events: none;
}

.dark-theme {
  background-color: #1A1A1A;
  color: #fff;
}

.dark-theme #wheel-container {
  background: linear-gradient(135deg, #333, #444);
}

.dark-theme .navbar-custom {
  background: linear-gradient(90deg, #2c3e50, #34495e);
}

.dark-theme .btn-primary {
  background: linear-gradient(45deg, #2c3e50, #3498db);
}

@media (max-width: 768px) {
  #overlayButton, #winnerOverlay, #emptyWheelOverlay { font-size: 18px; }
  #namesInput { font-size: 14px; }
}

#scoreboard .list-group-item {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #e9ecef, #f8f9fa);
  border: none;
  border-radius: 10px;
  margin-bottom: 2px;
  padding: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

#scoreboard .list-group-item:hover {
  transform: scale(1.02);
}

#scoreboard .order-number {
  width: 30px;
  height: 30px;
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  margin-right: 10px;
}

/* ====== Tools Section Styles ====== */
#tools-container {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 40px 20px;
  margin-top: 30px;
}

.dark-theme #tools-container {
  background: linear-gradient(135deg, #222, #333);
}

.tools-section {
  max-width: 1000px;
  margin: 0 auto;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

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

.tools-header {
  text-align: center;
  margin-bottom: 40px;
}

.tools-header > div {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.tools-header h2 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  text-align: left;
  margin: 0 0 10px 0;
}

.tools-subtitle {
  font-size: 1.1rem;
  color: #666;
  text-align: left;
}

.btn-back-to-wheel {
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.btn-back-to-wheel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.dark-theme .btn-back-to-wheel {
  background: linear-gradient(45deg, #2c3e50, #3498db);
}

@media (max-width: 768px) {
  .tools-header > div {
    flex-direction: column;
    align-items: stretch;
  }

  .tools-header h2 {
    font-size: 1.8rem;
    text-align: center;
  }

  .tools-subtitle {
    text-align: center;
  }

  .btn-back-to-wheel {
    width: 100%;
    text-align: center;
  }
}

.dark-theme .tools-subtitle {
  color: #aaa;
}

.tools-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark-theme .tools-content {
  background: #2a2a2a;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ====== Number Generator Styles ====== */
.number-generator-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 768px) {
  .number-generator-wrapper {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

/* Input Section */
.generator-inputs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.dark-theme .input-group label {
  color: #ddd;
}

.generator-input {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'Quicksand', sans-serif;
  transition: all 0.3s ease;
  background: white;
  color: #333;
}

.dark-theme .generator-input {
  background: #3a3a3a;
  border-color: #555;
  color: #fff;
}

.generator-input:focus {
  outline: none;
  border-color: #1E90FF;
  box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1);
}

.generator-btn {
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.generator-btn:hover:not(.loading) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(30, 144, 255, 0.3);
}

.generator-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-text {
  display: inline;
}

.btn-icon {
  font-size: 1.2rem;
  display: inline-block;
}

/* Display Section */
.generator-display {
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-display-container {
  text-align: center;
  width: 100%;
}

.number-label {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dark-theme .number-label {
  color: #999;
}

.number-display {
  font-size: 5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #1E90FF, #00BFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 20px;
  font-family: 'Courier New', monospace;
  min-height: 6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.number-display.generating {
  animation: pulse 0.15s ease-in-out infinite;
}

.number-display.generated {
  animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

@keyframes scaleUp {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.number-range {
  font-size: 1rem;
  color: #888;
  margin-top: 15px;
}

.dark-theme .number-range {
  color: #777;
}

/* History Section */
.generator-history {
  grid-column: 1 / -1;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #e0e0e0;
}

.dark-theme .generator-history {
  border-top-color: #444;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
}

.dark-theme .history-header h4 {
  color: #ddd;
}

.btn-icon-small {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
}

.btn-icon-small:hover {
  transform: scale(1.2) rotate(10deg);
}

.dice-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .dice-history-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

.empty-history {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-style: italic;
}

.dice-history-item {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 2px solid #e0e0e0;
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease forwards;
  opacity: 0;
}

.dark-theme .dice-history-item {
  background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
  border-color: #444;
}

.dice-history-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #1E90FF;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1E90FF;
  font-family: 'Courier New', monospace;
}

.history-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
  font-size: 0.8rem;
}

.history-range {
  color: #666;
  font-weight: 500;
}

.dark-theme .history-range {
  color: #aaa;
}

.history-time {
  color: #999;
  font-size: 0.75rem;
}

.dark-theme .history-time {
  color: #777;
}

.btn-copy-small {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.dark-theme .btn-copy-small:hover {
  transform: scale(1.3);
  opacity: 1;
}

/* ====== Quick Tools Section ====== */
.quick-tools-section {
  padding: 60px 20px 40px;
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.05), rgba(0, 191, 255, 0.05));
  border-top: 2px solid #e0e0e0;
}

.dark-theme .quick-tools-section {
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.1), rgba(0, 191, 255, 0.1));
  border-top-color: #444;
}

.quick-tools-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 40px;
  background: linear-gradient(45deg, #1E90FF, #00BFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dark-theme .quick-tools-title {
  color: #ddd;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.tool-card {
  background: white;
  border-radius: 15px;
  padding: 30px 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.dark-theme .tool-card {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.tool-card:hover::before {
  left: 100%;
}

.tool-card:hover {
  transform: translateY(-8px);
  border-color: #1E90FF;
  box-shadow: 0 12px 24px rgba(30, 144, 255, 0.2);
}

.tool-card:focus {
  outline: 3px solid rgba(30,144,255,0.9);
  outline-offset: 6px;
}

/* Sticky tools toolbar */
#tools-toolbar {
  position: fixed;
  right: 16px;
  top: 72px; /* avoid overlapping the top navbar */
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.tool-toggle {
  background: linear-gradient(45deg, #ffffff, #f1f5f9);
  border: 1px solid rgba(0,0,0,0.08);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  font-weight: 700;
}
.tool-toggle:focus {
  outline: 3px solid rgba(30,144,255,0.9);
}

/* 3D center knob overlay */
#wheel-center {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  border-radius: 50%;
  /* default size; JS updates to match canvas */
  width: 60px;
  height: 60px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.9), rgba(255,255,255,0.6) 8%, rgba(220,220,220,0.95) 20%, rgba(200,200,200,0.9) 60%, rgba(120,120,120,0.85) 100%);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25), inset 0 8px 20px rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.6);
}

/* subtle glossy highlight */
#wheel-center::after{
  content: '';
  position: absolute;
  left: 10%;
  top: 8%;
  width: 60%;
  height: 35%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.05));
  mix-blend-mode: screen;
  opacity: 0.9;
  transform: translateY(-5%);
}

@media (prefers-reduced-motion: reduce) {
  #wheel-center::after { transition: none; }
}

/* 3D-style pointer */
#pointer {
  background: linear-gradient(180deg, #2aa3ff 0%, #0f73e6 60%);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(13,80,170,0.18), inset 0 -6px 12px rgba(255,255,255,0.12);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  display: block;
  transform-origin: 50% 10%;
}

#pointer::before{
  content: '';
  position: absolute;
  left: 12%;
  top: 8%;
  width: 76%;
  height: 36%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(255,255,255,0.05));
  border-radius: 2px;
  mix-blend-mode: screen;
  pointer-events: none;
}

#pointer::after{
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.12));
  filter: blur(6px);
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 992px) {
  /* On smaller screens, move toolbar further down and slightly left so it doesn't cover controls */
  #tools-toolbar { top: 84px; right: 12px; }
}

@media (max-width: 576px) {
  /* Hide toolbar on very small screens to avoid overlap with mobile nav */
  #tools-toolbar { display: none; }
}

.dark-theme .tool-card:hover {
  box-shadow: 0 12px 24px rgba(30, 144, 255, 0.3);
}

.tool-card-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.15) rotate(5deg);
}

.tool-card h4 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 12px;
  margin-top: 0;
}

.dark-theme .tool-card h4 {
  color: #fff;
}

.tool-card p {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0;
  line-height: 1.5;
}

.dark-theme .tool-card p {
  color: #aaa;
}

.tool-card-arrow {
  position: absolute;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.8rem;
  color: #1E90FF;
  opacity: 0;
  transition: all 0.3s ease;
}

.tool-card:hover .tool-card-arrow {
  opacity: 1;
  right: 20px;
}

@media (max-width: 768px) {
  .quick-tools-section {
    padding: 40px 20px 30px;
  }

  .quick-tools-title {
    font-size: 1.4rem;
    margin-bottom: 30px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .tool-card {
    padding: 25px 20px;
  }

  .tool-card-icon {
    font-size: 2.5rem;
  }

  .tool-card h4 {
    font-size: 1.1rem;
  }

  .tool-card p {
    font-size: 0.9rem;
  }
}

/* Dice Loader Styles */
.dice-roller-wrapper {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.dice-controls-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  padding: 20px;
  border-radius: 12px;
  border: 2px solid rgba(102, 126, 234, 0.2);
}

.controls-label {
  display: block;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-color, #333);
  font-size: 1rem;
}

.dice-count-control {
  display: flex;
  align-items: center;
  gap: 15px;
}

.dice-count-btn {
  width: 45px;
  height: 45px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-count-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.05);
}

.dice-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #667eea, #764ba2);
  outline: none;
  border-radius: 3px;
  cursor: pointer;
}

.dice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 3px solid #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.dice-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.dice-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 3px solid #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.dice-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.dice-count-display {
  min-width: 45px;
  text-align: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: #667eea;
}

.dice-animation-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(245, 247, 250, 0.8));
  padding: 40px 20px;
  border-radius: 15px;
  border: 2px solid rgba(102, 126, 234, 0.15);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  width: 100%;
  perspective: 1000px;
}

.dice-item {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #fff9e6, #ffe6cc);
  border: 3px solid #ffcc99;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  cursor: default;
  transition: all 0.1s ease;
  position: relative;
  transform-style: preserve-3d;
  padding: 8px;
}

.dice-face {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  position: relative;
}

.dot {
  width: 12px;
  height: 12px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dot.center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.dot.top-left {
  top: 8%;
  left: 8%;
}

.dot.top-right {
  top: 8%;
  right: 8%;
}

.dot.middle-left {
  top: 50%;
  left: 8%;
  transform: translateY(-50%);
}

.dot.middle-right {
  top: 50%;
  right: 8%;
  transform: translateY(-50%);
}

.dot.bottom-left {
  bottom: 8%;
  left: 8%;
}

.dot.bottom-right {
  bottom: 8%;
  right: 8%;
}

.dice-item.dice-landed {
  animation: dice-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dice-bounce {
  0% {
    transform: scale(0.8) rotateX(0deg) rotateY(0deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
  50% {
    transform: scale(1.1) rotateX(10deg) rotateY(10deg);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.3);
  }
  100% {
    transform: scale(1) rotateX(0deg) rotateY(0deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
}

.dice-button-section {
  display: flex;
  justify-content: center;
}

.dice-roll-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  cursor: pointer;
}

.dice-roll-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.dice-roll-btn:active:not(:disabled) {
  transform: translateY(0);
}

.dice-roll-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dice-results-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  padding: 25px;
  border-radius: 12px;
  border: 2px solid rgba(102, 126, 234, 0.2);
  animation: slideInUp 0.4s ease-out;
}

.dice-results-section.animate-in {
  animation: slideInUp 0.4s ease-out;
}

.results-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item.total {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 20px;
  border-radius: 10px;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.result-label {
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.result-value-item {
  background: white;
  color: #667eea;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-total {
  font-size: 3rem;
  font-weight: 700;
}

.dice-history-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(245, 247, 250, 0.8));
  padding: 25px;
  border-radius: 12px;
  border: 2px solid rgba(102, 126, 234, 0.15);
}

.rng-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.rng-history-list::-webkit-scrollbar {
  width: 6px;
}

.rng-history-list::-webkit-scrollbar-track {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 3px;
}

.rng-history-list::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 3px;
}

.rng-history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

.rng-history-item {
  background: white;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.3s ease;
  animation: slideInUp 0.3s ease-out;
}

.rng-history-item:hover {
  background: #f8f9ff;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.dark-theme .rng-history-item {
  background: #2a2a3a;
  border-left-color: #667eea;
}

.dark-theme .rng-history-item:hover {
  background: #333344;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.history-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-dice-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-dice-badge {
  background: #667eea;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
}

.history-results {
  color: #666;
  font-size: 0.95rem;
}

.history-total {
  color: #667eea;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

.history-time {
  font-size: 0.75rem;
  color: #999;
  white-space: nowrap;
  margin-left: 10px;
}

.empty-history {
  text-align: center;
  padding: 20px;
  color: #999;
  font-style: italic;
}

/* Dark Theme */
.dark-theme .dice-controls-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
}

.dark-theme .dice-animation-section {
  background: linear-gradient(135deg, rgba(50, 50, 60, 0.8), rgba(60, 60, 75, 0.8));
}

.dark-theme .dice-item {
  background: linear-gradient(135deg, #444, #333);
  color: #fff;
  border-color: #555;
}

.dark-theme .dice-item:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.dark-theme .dot {
  background: #fff;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.dark-theme .dice-results-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
}

.dark-theme .result-value-item {
  background: #444;
  color: #a8b8ff;
}

.dark-theme .dice-history-section {
  background: linear-gradient(135deg, rgba(50, 50, 60, 0.8), rgba(60, 60, 75, 0.8));
}

.dark-theme .dice-history-item {
  background: #2a2a3a;
}

.dark-theme .dice-history-item:hover {
  background: #333344;
}

.dark-theme .history-results {
  color: #bbb;
}

/* Responsive */
@media (max-width: 768px) {
  .dice-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .dice-item {
    font-size: 1.8rem;
  }

  .results-container {
    grid-template-columns: 1fr;
  }

  .dice-slider {
    height: 5px;
  }

  .dice-count-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .result-total {
    font-size: 2.2rem;
  }

  .history-item {
    flex-direction: column;
    gap: 8px;
  }

  .history-content {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .history-time {
    margin-left: 0;
    margin-top: 8px;
  }

  .history-total {
    text-align: left;
    width: 100%;
  }
}


/* Toast tweaks */
#appToast { box-shadow: 0 12px 40px rgba(0,0,0,0.25); }

/* Right panel button group */
#removeDuplicates, #shuffleNames, #loadSample { white-space: nowrap; }

/* Mobile: give wheel more room and avoid vh issues */
@media (max-width: 768px) {
  #wheel-container { height: auto; min-height: 360px; padding-bottom: 24px; }
  .col-md-4 .p-3 { padding-top: 12px !important; }
}


/* Share actions */
#shareActions .btn { white-space: nowrap; }
@media (max-width: 576px) {
  #shareActions .btn { flex: 1 1 auto; }
}
