/* ═══════════════════════════════════════════════════════
   Half-Life Dice Simulation — Clay Design System Modal Styles
   ═══════════════════════════════════════════════════════ */

/* ── Modal Overlay ── */
.hl-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,15,26,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.hl-modal-overlay.open { display: flex; }

.hl-modal {
  background: var(--canvas, #F4F1FA);
  border-radius: var(--radius-card, 32px);
  padding: 24px;
  width: 100%;
  max-width: 1060px;
  max-height: 94vh;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow-y: auto;
}

.hl-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(160,150,180,0.15);
  border-radius: 14px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted, #635F69);
  cursor: pointer;
  z-index: 10;
  transition: all var(--dur-fast, 200ms) var(--ease-smooth, cubic-bezier(0.16,1,0.3,1));
  box-shadow: var(--shadow-card, 16px 16px 32px rgba(160,150,180,0.2));
}
.hl-modal-close:hover {
  color: var(--accent-rose, #F43F5E);
  background: rgba(255,255,255,1);
}

/* ── Header ── */
.hl-header { text-align: center; margin-bottom: 16px; padding-right: 40px; }
.hl-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 800;
  background: linear-gradient(90deg, #5D5CDE, #FC76A1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 2px;
}
.hl-header p { font-size: .85rem; color: var(--text-muted, #635F69); }

/* ── Grid layout ── */
.hl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 800px) { .hl-grid { grid-template-columns: 1fr; } }

/* ── Cards ── */
.hl-card {
  background: #fff; border-radius: 14px; padding: 16px;
  box-shadow: 0 3px 12px rgba(2,6,23,.07); border: 1px solid #e2e8f0;
}
.hl-card h2 {
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700;
  color: var(--accent-emerald, #10B981); margin-bottom: 12px;
}
.hl-card h3 { font-family: var(--font-heading); font-size: .9rem; font-weight: 700; color: var(--text-primary, #332F3A); margin-bottom: 6px; }

/* ── Form elements ── */
.hl-card label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-muted, #635F69); margin-bottom: 4px; }
.hl-card select {
  width: 100%; padding: 8px 10px; border: 2px solid rgba(160,150,180,0.15);
  border-radius: 12px; font-size: .9rem; font-family: var(--font-body);
  background: #EFEBF5; color: var(--text-primary); margin-bottom: 10px;
}
.hl-card select:focus { outline: none; border-color: var(--accent); }

/* ── Buttons ── */
.hl-btn {
  border: none; border-radius: var(--radius-btn, 20px); padding: 10px 22px;
  font-weight: 700; font-size: .85rem; cursor: pointer; transition: all .2s;
  line-height: 1; font-family: var(--font-body);
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: #fff; box-shadow: var(--shadow-btn);
}
.hl-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-btn-hover); }
.hl-btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.hl-btn-full { width: 100%; display: block; text-align: center; margin-top: 8px; }
.hl-btn-sm { padding: 6px 14px; font-size: .8rem; }

/* ── Stats grid ── */
.hl-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.hl-stat {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px;
}
.hl-stat .hl-lbl { display: block; font-size: .7rem; color: #64748b; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hl-stat .hl-num { font-size: 1.1rem; font-weight: 800; color: var(--accent-amber, #F59E0B); }

/* ── Dice area ── */
.hl-dice-area {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 3px 12px rgba(2,6,23,.07); border: 1px solid #e2e8f0;
}
.hl-dice-area h2 {
  font-family: var(--font-heading); font-size: 1rem; font-weight: 700;
  color: var(--text-primary, #332F3A); margin-bottom: 8px; text-align: center;
}

.hl-dice-container {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  max-width: 600px; margin: 0 auto; min-height: 60px;
}
.hl-die {
  width: 34px; height: 34px; border-radius: 5px; border: 2px solid #d1d5db;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; transition: all .3s ease;
  color: #fff; background: linear-gradient(135deg, #5D5CDE, #FC76A1);
}
.hl-die.hl-removed { opacity: .3; transform: scale(.8); background: #94a3b8; border-color: #94a3b8; }

/* ── Data table ── */
.hl-table-wrap { max-height: 140px; overflow-y: auto; margin-top: 8px; }
.hl-table { width: 100%; font-size: .82rem; border-collapse: collapse; }
.hl-table th {
  background: var(--accent-emerald, #10B981); color: #fff; padding: 6px 10px;
  font-family: var(--font-heading); font-weight: 700; font-size: .75rem;
  position: sticky; top: 0; text-align: left;
}
.hl-table td { padding: 5px 10px; border-bottom: 1px solid #e2e8f0; color: var(--text-muted, #635F69); }

/* ── Chart ── */
.hl-chart-area {
  background: #fff; border-radius: 14px; padding: 16px;
  box-shadow: 0 3px 12px rgba(2,6,23,.07); border: 1px solid #e2e8f0;
}
.hl-chart-area h2 {
  font-family: var(--font-heading); font-size: 1rem; font-weight: 700;
  color: var(--text-primary, #332F3A); margin-bottom: 8px;
}
.hl-chart-box { height: 260px; width: 100%; }
.hl-chart-box .js-plotly-plot, .hl-chart-box .plotly { width: 100% !important; }

/* ── Scrollbar ── */
.hl-modal::-webkit-scrollbar { width: 6px; }
.hl-modal::-webkit-scrollbar-track { background: transparent; }
.hl-modal::-webkit-scrollbar-thumb { background: rgba(160,150,180,0.3); border-radius: 3px; }
.hl-table-wrap::-webkit-scrollbar { width: 4px; }
.hl-table-wrap::-webkit-scrollbar-thumb { background: rgba(160,150,180,0.2); border-radius: 2px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .hl-modal { padding: 14px; }
  .hl-stats { grid-template-columns: 1fr 1fr; }
  .hl-die { width: 28px; height: 28px; font-size: .7rem; }
}