/* GratisDobbelSteen.nl — dice widget styles
   Reuses the existing palette (main.css :root variables) so the new
   self-contained engine blends with the established visual identity. */

.gds-dice {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

/* --- Controls --- */
.gds-control { margin-bottom: 1.1rem; }
.gds-label {
  display: block;
  font-weight: 600;
  color: var(--primary-color, #2c3e50);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
.gds-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.gds-tab {
  border: 2px solid #d7dde2;
  background: #fff;
  color: var(--primary-color, #2c3e50);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius, 8px);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition, all 0.2s ease);
  min-width: 48px;
}
.gds-tab:hover { border-color: var(--secondary-color, #3498db); }
.gds-tab.active {
  background: var(--secondary-color, #3498db);
  border-color: var(--secondary-color, #3498db);
  color: #fff;
}

/* --- Stage --- */
.gds-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  margin: 1.4rem auto;
  padding: 1.2rem;
}
.gds-mode-3d {
  perspective: 760px;
  perspective-origin: 50% 45%;
}
.gds-mode-3d.gds-grabbing { cursor: grabbing; }
.gds-mode-3d .gds-cube-holder { cursor: grab; }

/* --- 3D cube --- */
.gds-cube-holder {
  width: 86px;
  height: 86px;
}
.gds-cube {
  position: relative;
  width: 86px;
  height: 86px;
  transform-style: preserve-3d;
  will-change: transform;
}
.gds-face {
  position: absolute;
  width: 86px;
  height: 86px;
  background: linear-gradient(145deg, #ffffff, #eef2f5);
  border: 1px solid #cfd6dc;
  border-radius: 14px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.06);
  backface-visibility: hidden;
}
.gds-face-front  { transform: translateZ(43px); }
.gds-face-back   { transform: rotateY(180deg) translateZ(43px); }
.gds-face-right  { transform: rotateY(90deg)  translateZ(43px); }
.gds-face-left   { transform: rotateY(-90deg) translateZ(43px); }
.gds-face-top    { transform: rotateX(90deg)  translateZ(43px); }
.gds-face-bottom { transform: rotateX(-90deg) translateZ(43px); }

/* --- Pips (shared by cube faces and flat 2D face) --- */
.gds-pip {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a5a6a, var(--primary-color, #2c3e50) 70%);
  box-shadow: inset 0 -1px 2px rgba(0,0,0,0.35);
}

/* --- Flat 2D die face --- */
.gds-flat {
  position: relative;
  width: 92px;
  height: 92px;
  background: linear-gradient(145deg, #ffffff, #eef2f5);
  border: 1px solid #cfd6dc;
  border-radius: 16px;
  box-shadow: var(--shadow, 0 2px 10px rgba(0,0,0,0.1));
  animation: gds-pop 0.25s ease;
}
@keyframes gds-pop { from { transform: scale(0.85); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

/* --- Polyhedral numeric token --- */
.gds-token {
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--secondary-color, #3498db), var(--primary-color, #2c3e50));
  box-shadow: var(--shadow, 0 2px 10px rgba(0,0,0,0.1));
  animation: gds-pop 0.25s ease;
}
.gds-d6  { border-radius: 16px; }
.gds-d8  { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.gds-d10 { clip-path: polygon(50% 0, 90% 35%, 75% 100%, 25% 100%, 10% 35%); }
.gds-d12 { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.gds-d20 { clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.gds-d100 { border-radius: 50%; font-size: 1.5rem; letter-spacing: -0.02em; }

/* --- Highlight the value "1" in red (single pip dot & numeric "1") --- */
.gds-face .gds-pip:only-child,
.gds-flat .gds-pip:only-child {
  background: radial-gradient(circle at 35% 30%, #ff5e57, #c0392b 70%);
}
.gds-token.gds-one {
  color: #ff4d4d;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* --- Roll button --- */
.gds-roll-wrap { margin: 0.5rem auto 0.8rem; }
.gds-roll { min-width: 220px; }
.gds-hint {
  font-size: 0.85rem;
  color: #7a8794;
  margin-top: 0.6rem;
}

/* --- Results --- */
.gds-results {
  background: #f6f8fa;
  border-radius: var(--border-radius, 8px);
  padding: 1.1rem 1rem;
  margin: 1rem auto;
}
.gds-result-title {
  margin: 0 0 0.7rem;
  font-size: 1.15rem;
  color: var(--primary-color, #2c3e50);
}
.gds-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.6rem;
}
.dice-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.4rem;
  background: var(--secondary-color, #3498db);
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 10px;
}
.gds-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}
.gds-stat {
  background: #fff;
  border: 1px solid #e3e8ec;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  min-width: 92px;
}
.gds-stat-label { display: block; font-size: 0.75rem; color: #7a8794; }
.gds-stat-val { font-weight: 700; color: var(--primary-color, #2c3e50); }

/* --- Bottom bar + history + sound --- */
.gds-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.4rem;
}
.gds-hist-toggle, .gds-sound, .gds-clear {
  background: none;
  border: 1px solid #d7dde2;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  color: var(--primary-color, #2c3e50);
  font-size: 0.85rem;
  transition: var(--transition, all 0.2s ease);
}
.gds-hist-toggle:hover, .gds-sound:hover, .gds-clear:hover { border-color: var(--secondary-color, #3498db); }
.gds-hist-panel {
  max-width: 460px;
  margin: 0.8rem auto 0;
  text-align: left;
}
.gds-hist-empty { color: #7a8794; text-align: center; font-size: 0.9rem; }
.gds-hist-item {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #eef1f4;
  font-size: 0.9rem;
}
.gds-hist-no { color: #9aa6b1; min-width: 34px; }
.gds-hist-vals { flex: 1; }
.gds-hist-sum { font-weight: 700; color: var(--success-color, #27ae60); }
.gds-clear-inline { margin: 0.7rem auto 0; display: block; }

@media (max-width: 480px) {
  .gds-cube-holder, .gds-cube, .gds-face { width: 72px; height: 72px; }
  .gds-face-front  { transform: translateZ(36px); }
  .gds-face-back   { transform: rotateY(180deg) translateZ(36px); }
  .gds-face-right  { transform: rotateY(90deg)  translateZ(36px); }
  .gds-face-left   { transform: rotateY(-90deg) translateZ(36px); }
  .gds-face-top    { transform: rotateX(90deg)  translateZ(36px); }
  .gds-face-bottom { transform: rotateX(-90deg) translateZ(36px); }
  .gds-flat, .gds-token { width: 76px; height: 76px; font-size: 1.6rem; }
  .gds-d100 { font-size: 1.2rem; }
  .gds-pip { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; }
  .gds-roll { min-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .gds-cube { transition: none !important; }
  .gds-flat, .gds-token { animation: none; }
}

/* Secondary button (cross-mode links) */
.btn-secondary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--secondary-color, #3498db);
  color: #fff;
  text-decoration: none;
  border-radius: var(--border-radius, 8px);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn-secondary:hover {
  background: var(--primary-color, #2c3e50);
  transform: translateY(-1px);
}
