/* Dice roller page: quick dice, result tiles, pip faces and the history. */

.dice-quick {
  margin: 0;
  padding: 0;
  border: 0;
}

.dice-quick legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 650;
}

/* One row of equal dice on desktop; a tidy 4-column grid on phones. */
.dice-quick-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.dice-quick-grid .btn {
  width: 100%;
  min-height: 44px;
  padding: 8px 6px;
}

.dice-quick .btn[aria-pressed="true"] {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.dice-notation-field { margin-top: 14px; }

.dice-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}

.dice-result.is-rolling { animation: dice-shake 0.4s ease-in-out 2; }
.dice-result.is-rolling .die { filter: blur(1px); }

@keyframes dice-shake {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-4px) rotate(-2deg); }
  75% { transform: translateY(3px) rotate(2deg); }
}

.die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  font-size: 1.05rem;
  font-weight: 700;
}

.die--num {
  padding: 0 8px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--cream);
}

.die--d6 {
  width: 46px;
  padding: 6px;
  border: 2px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
}

.die-pips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
}

.die-pips i { border-radius: 50%; background: transparent; }
.die-pips i.on { background: var(--navy); }

.dice-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 16px 0 0;
  padding: 0;
}

.dice-lines div { margin: 0; }
.dice-lines dt { color: var(--navy-soft); font-size: 0.85rem; }
.dice-lines dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 700; }

.dice-history {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.dice-history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.dice-history li:last-child { border-bottom: 0; }
.dice-history .notation { font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.dice-history .total { margin-left: auto; color: var(--navy-soft); }

@media (max-width: 480px) {
  /* Keep the roll button and the result inside the first 390x844 view: one row of
     quick dice, tighter panel spacing and the three result stats on one line.
     Matters most for the longer Spanish copy; 44px touch targets are kept. */
  .panel { padding: 12px; }
  .page-head { margin-bottom: 4px; }
  .page-head h1 { margin-bottom: 4px; }
  .settings-grid .field { flex: 1 1 40%; min-width: 0; }
  .dice-quick legend { margin-bottom: 2px; }
  .dice-quick-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .dice-quick-grid .btn { min-height: 44px; padding: 8px 2px; font-size: 0.78rem; }
  .dice-notation-field { margin-top: 6px; }
  .dice-notation-field + .hint { font-size: 0.82rem; line-height: 1.3; margin-top: 4px; }
  .panel input[type="number"], .panel input[type="text"] { padding: 8px 10px; }
  .dice-result { gap: 8px; min-height: 40px; }
  .dice-lines {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 8px;
  }
  .dice-lines div { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
  .dice-lines dt { font-size: 0.78rem; line-height: 1.2; white-space: nowrap; }
  .dice-lines dd { margin: 0; font-size: 1rem; }
  .wheel-column .panel h2 { margin-bottom: 6px; }
  .button-row { margin-top: 10px; }
  .die { min-width: 40px; height: 40px; font-size: 0.95rem; }
  .die--d6 { width: 40px; padding: 5px; }
}

@media (max-width: 360px) {
  /* Below 360px seven columns would shrink the touch targets. */
  .dice-quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .dice-quick-grid .btn { font-size: 0.85rem; padding: 8px 6px; }
  .dice-lines { flex-wrap: wrap; gap: 6px 12px; }
}
