/* ============================================================
   RECATOOLS — Dice Roller  (RT-FUN-005)
   Tool-specific styles only — tool-page.css handles base layout
   ============================================================ */

/* ─── Dice selector grid ────────────────────────────────────────────────── */
.dice-selector-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .dice-selector-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 375px) {
  .dice-selector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  background: #fff;
  border: 2px solid #E2E4E8;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s, background 0.15s;
  font-family: 'IBM Plex Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dice-btn:hover {
  border-color: #E8472F;
  box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.14);
  transform: translateY(-2px);
  background: #FFF5F2;
}

.dice-btn:active {
  transform: translateY(0) scale(0.96);
}

.dice-btn-icon {
  font-size: 22px;
  line-height: 1;
  color: #E8472F;
}

.dice-btn-label {
  font-size: 12px;
  font-weight: 700;
  color: #0D1B2A;
  letter-spacing: 0.02em;
}

/* ─── Pool display ──────────────────────────────────────────────────────── */
.pool-section {
  background: #FFFFFF;
  border: 1px solid #E2E4E8;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  min-height: 72px;
}

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

.pool-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.clear-all-btn {
  font-size: 12px;
  font-weight: 600;
  color: #E8472F;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.clear-all-btn:hover {
  background: rgba(232, 98, 42, 0.1);
}

#pool-empty {
  font-size: 14px;
  color: #a09d99;
  text-align: center;
  padding: 8px 0;
}

.pool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #E2E4E8;
}

.pool-row:last-child {
  border-bottom: none;
}

.pool-die-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #0D1B2A;
  min-width: 68px;
}

.pool-die-icon {
  color: #E8472F;
  font-size: 17px;
}

.pool-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1.5px solid #E2E4E8;
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0D1B2A;
  font-weight: 500;
  transition: border-color 0.14s, background 0.14s;
}

.qty-btn:hover {
  border-color: #E8472F;
  background: #FFF5F2;
  color: #E8472F;
}

.pool-qty {
  font-size: 16px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  color: #0D1B2A;
}

.remove-die-btn {
  background: none;
  border: none;
  color: #a09d99;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.14s, background 0.14s;
  line-height: 1;
}

.remove-die-btn:hover {
  color: #E8472F;
  background: rgba(232, 98, 42, 0.08);
}

/* ─── Options row ───────────────────────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
}

.option-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #E2E4E8;
  border-radius: 8px;
  font-size: 15px;
  font-family: 'IBM Plex Sans', sans-serif;
  color: #0D1B2A;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.option-input:focus {
  outline: none;
  border-color: #E8472F;
  box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.12);
}

/* ─── Custom die row ────────────────────────────────────────────────────── */
.custom-die-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.custom-die-row .input-label {
  white-space: nowrap;
  flex-shrink: 0;
}

.custom-die-input {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 1.5px solid #E2E4E8;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: 'IBM Plex Sans', sans-serif;
  color: #0D1B2A;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.custom-die-input:focus {
  border-color: #E8472F;
  box-shadow: 0 0 0 3px rgba(232, 98, 42, 0.12);
}

.add-custom-btn {
  padding: 10px 18px;
  background: #0D1B2A;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.12s;
  font-family: 'IBM Plex Sans', sans-serif;
}

.add-custom-btn:hover {
  background: #E8472F;
}

.add-custom-btn:active {
  transform: scale(0.97);
}

/* ─── Advantage row ─────────────────────────────────────────────────────── */
#advantage-row {
  margin-bottom: 20px;
}

.adv-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adv-btn {
  padding: 9px 16px;
  border: 1.5px solid #E2E4E8;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: 'IBM Plex Sans', sans-serif;
}

.adv-btn:hover {
  border-color: #E8472F;
  color: #E8472F;
}

.adv-btn.active {
  background: #E8472F;
  border-color: #E8472F;
  color: #fff;
}

/* ─── Roll button ───────────────────────────────────────────────────────── */
/* Roll button base — shared styles */
#roll-btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s, color 0.15s;
  font-family: 'IBM Plex Serif', serif;
  margin-bottom: 24px;
}

/* Active state — dice selected */
#roll-btn.roll-btn-active {
  background: #E8472F;
  color: #fff;
  cursor: pointer;
}

#roll-btn.roll-btn-active:hover {
  background: #d4541e;
  box-shadow: 0 4px 18px rgba(232, 98, 42, 0.32);
  transform: translateY(-1px);
}

#roll-btn.roll-btn-active:active {
  transform: translateY(0) scale(0.98);
}

/* Muted state — no dice selected yet */
#roll-btn.roll-btn-muted {
  background: #f0ede9;
  color: #9ca3af;
  cursor: not-allowed;
  font-size: 15px;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  letter-spacing: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  15%       { transform: translateX(-4px) rotate(-2deg); }
  30%       { transform: translateX(4px) rotate(2deg); }
  45%       { transform: translateX(-3px) rotate(-1deg); }
  60%       { transform: translateX(3px) rotate(1deg); }
  75%       { transform: translateX(-2px) rotate(-0.5deg); }
  90%       { transform: translateX(2px) rotate(0.5deg); }
}

#roll-btn.shaking {
  animation: shake 0.5s ease-in-out;
}

/* ─── Sound toggle ──────────────────────────────────────────────────────── */
#sound-toggle {
  background: none;
  border: 1.5px solid #E2E4E8;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  cursor: pointer;
  margin-bottom: 24px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: 'IBM Plex Sans', sans-serif;
}

#sound-toggle.active {
  border-color: #E8472F;
  color: #E8472F;
  background: #FFF5F2;
}

/* ─── Results section ───────────────────────────────────────────────────── */
#results-section {
  display: none;
  margin-bottom: 24px;
}

#results-section.visible {
  display: block;
}

.roll-result-wrap {
  background: #FFFFFF;
  border: 1px solid #E2E4E8;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}

.roll-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  margin-bottom: 12px;
}

.result-group {
  margin-bottom: 12px;
}

.result-dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

@keyframes flipIn {
  0%   { transform: rotateY(90deg) scale(0.8); opacity: 0; }
  60%  { transform: rotateY(-12deg) scale(1.08); opacity: 1; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

.die-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 56px;
  padding: 8px 12px;
  background: #fff;
  border: 2px solid #E8472F;
  border-radius: 10px;
  animation: flipIn 0.35s ease-out both;
  position: relative;
}

.die-result-icon {
  font-size: 13px;
  color: #E8472F;
  line-height: 1;
}

.die-result-value {
  font-size: 22px;
  font-weight: 800;
  color: #0D1B2A;
  line-height: 1.1;
  font-family: 'IBM Plex Serif', serif;
}

.die-discarded {
  font-size: 11px;
  color: #a09d99;
  text-decoration: line-through;
}

.result-subtotal {
  font-size: 13px;
  color: #64748B;
  font-weight: 600;
  padding-left: 2px;
}

.result-divider {
  height: 1px;
  background: #E2E4E8;
  margin: 12px 0;
}

.result-total-line,
.result-mod-line {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 4px;
}

.result-total-value {
  color: #0D1B2A;
  font-weight: 700;
}

.result-final-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-final-line span:first-child {
  font-size: 15px;
  font-weight: 700;
  color: #0D1B2A;
}

.result-final-value {
  font-size: 36px;
  font-weight: 800;
  color: #E8472F;
  font-family: 'IBM Plex Serif', serif;
  line-height: 1;
}

/* ─── Roll history ──────────────────────────────────────────────────────── */
.history-section {
  margin-bottom: 8px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 12px 16px;
  background: #FFFFFF;
  border: 1px solid #E2E4E8;
  border-radius: 10px;
  transition: background 0.14s;
}

.history-header:hover {
  background: #f0ede8;
}

.history-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #0D1B2A;
}

.hist-toggle-icon {
  font-size: 18px;
  color: #E8472F;
  font-weight: 400;
  line-height: 1;
}

#history-panel {
  display: none;
  border: 1px solid #E2E4E8;
  border-top: none;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

#history-panel.open {
  display: block;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  font-weight: 700;
  background: #fafaf9;
  border-bottom: 1px solid #E2E4E8;
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0ede8;
  vertical-align: middle;
}

.history-table tr:last-child td {
  border-bottom: none;
}

.hist-time {
  color: #a09d99;
  white-space: nowrap;
  font-size: 12px;
}

.hist-expr {
  color: #0D1B2A;
  font-weight: 600;
}

.hist-vals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.hist-val {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #E2E4E8;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #0D1B2A;
  background: #fff;
}

.hist-total {
  font-weight: 800;
  color: #E8472F;
  font-size: 15px;
  text-align: right;
}

.history-empty {
  text-align: center;
  color: #a09d99;
  padding: 20px;
  font-size: 13px;
}

/* ─── Educational content ───────────────────────────────────────────────── */
.educational-content .pull-quote {
  background: #FFF5F2;
  border-left: 4px solid #E8472F;
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
}

.educational-content .pull-quote p {
  font-size: 16px;
  font-style: italic;
  color: #0D1B2A;
  line-height: 1.7;
  margin: 0;
}

/* ─── Responsive tweaks ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .die-result-card {
    min-width: 48px;
    min-height: 48px;
    padding: 6px 8px;
  }

  .die-result-value {
    font-size: 18px;
  }

  .result-final-value {
    font-size: 28px;
  }

  .history-table {
    font-size: 12px;
  }

  .history-table th,
  .history-table td {
    padding: 8px 8px;
  }
}

/* cache-buster: 2026-05-24T05:06:05Z */
