/* ═══════════════════════════════════════════════════════
   Hooke's Law Simulation — Clay Design System Modal Styles
   ═══════════════════════════════════════════════════════ */

/* ── Modal Overlay ── */
.hook-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;
}
.hook-modal-overlay.open { display: flex; }

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

.hook-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(160,150,180,0.15);
  border-radius: 14px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  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));
}
.hook-modal-close:hover {
  color: var(--accent-rose, #F43F5E);
  background: rgba(255,255,255,1);
}

/* ── Modal header ── */
.hook-header {
  text-align: center;
  margin-bottom: 18px;
  padding-right: 44px;
}
.hook-header h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 800;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #db2777);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}
.hook-header p {
  font-size: 0.85rem;
  color: var(--text-muted, #635F69);
}

/* ── Card within modal ── */
.hook-card {
  background: var(--card-bg, rgba(255,255,255,0.65));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(160,150,180,0.12);
  border-radius: var(--radius-card, 32px);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card, 16px 16px 32px rgba(160,150,180,0.2));
}
.hook-card h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8b5cf6;
  font-weight: 700;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hook-card h2::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(120deg, #6366f1, #a855f7);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.15);
}

/* ── Layout grid ── */
.hook-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 22px;
}
@media (max-width: 880px) {
  .hook-grid { grid-template-columns: 1fr; }
}

/* ── Stage / SVG ── */
.hook-stage-wrap {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(160,150,180,0.08);
  border-radius: var(--radius-card, 32px);
  overflow: hidden;
  padding: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card, 16px 16px 32px rgba(160,150,180,0.2));
}
.hook-stage-wrap svg.hook-stage {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* ── Weights tray ── */
.hook-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hook-chip {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: .72rem;
  color: #fff;
  transition: .25s cubic-bezier(.34,1.56,.64,1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(180,120,20,.6);
}
.hook-chip.avail {
  background: radial-gradient(circle at 35% 30%, #ffe08a, #e8a33d 55%, #b9781f);
}
.hook-chip.avail:hover { transform: translateY(-4px) scale(1.06); }
.hook-chip.loaded {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
}
.hook-chip.loaded::after {
  content: "✓";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #22c55e;
  color: #fff;
  border-radius: 50%;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(34,197,94,.5);
}
.hook-hint {
  font-size: .75rem;
  color: #94a3b8;
  margin-top: 10px;
}

/* ── Segmented control ── */
.hook-seg {
  display: flex;
  background: #eef2f7;
  border-radius: 14px;
  padding: 5px;
  gap: 4px;
}
.hook-seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .85rem;
  color: #64748b;
  cursor: pointer;
  transition: .2s;
}
.hook-seg button.on {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 4px 10px -4px rgba(79,70,229,.4);
}

/* ── Stats readings ── */
.hook-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hook-stat {
  background: linear-gradient(160deg, #ffffff, #f5f7ff);
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: 14px 16px;
}
.hook-stat .hook-lbl {
  font-size: .72rem;
  color: #94a3b8;
  font-weight: 500;
}
.hook-stat .hook-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #312e81;
  line-height: 1.2;
}
.hook-stat .hook-val small {
  font-size: .85rem;
  font-weight: 600;
  color: #818cf8;
  margin-left: 3px;
}
.hook-stat.hl {
  background: linear-gradient(140deg, #4f46e5, #7c3aed);
  border: none;
}
.hook-stat.hl .hook-lbl { color: rgba(255,255,255,.75); }
.hook-stat.hl .hook-val { color: #fff; }
.hook-stat.hl .hook-val small { color: rgba(255,255,255,.8); }

/* ── Buttons ── */
.hook-btns {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.hook-btn {
  flex: 1;
  border: none;
  padding: 13px;
  border-radius: 14px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-body, 'Inter', sans-serif);
}
.hook-btn:active { transform: scale(.97); }
.hook-btn-primary {
  background: linear-gradient(120deg, #4f46e5, #7c3aed);
  color: #fff;
  box-shadow: 0 10px 22px -8px rgba(99,102,241,.7);
}
.hook-btn-primary:hover { filter: brightness(1.08); }
.hook-btn-ghost {
  background: #fff;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.hook-btn-ghost:hover { background: #f8fafc; color: #475569; }
.hook-btn-sm {
  padding: 8px 16px;
  font-size: .82rem;
  flex: none;
}

/* ── Results table ── */
.hook-full { grid-column: 1 / -1; }
.hook-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.hook-row-between .hook-card-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8b5cf6;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hook-row-between .hook-card-title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(120deg, #6366f1, #a855f7);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.15);
}
.hook-link {
  background: none;
  border: none;
  color: #ef4444;
  font-weight: 600;
  font-size: .8rem;
  cursor: pointer;
}
.hook-link:hover { text-decoration: underline; }
.hook-tbl-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid #eef2f7;
}
.hook-tbl-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
.hook-tbl-wrap thead th {
  background: #f1f5f9;
  color: #475569;
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  white-space: nowrap;
  font-size: .78rem;
}
.hook-tbl-wrap tbody td {
  padding: 11px 14px;
  border-top: 1px solid #f1f5f9;
  color: #334155;
  font-variant-numeric: tabular-nums;
}
.hook-tbl-wrap tbody tr:nth-child(even) { background: #fafbff; }
.hook-tbl-wrap tbody tr { animation: hook-pop .35s ease; }
@keyframes hook-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hook-empty {
  text-align: center;
  color: #cbd5e1;
  padding: 26px;
  font-style: italic;
}
.hook-idx {
  display: inline-flex;
  width: 22px; height: 22px;
  background: linear-gradient(120deg, #6366f1, #a855f7);
  color: #fff;
  border-radius: 7px;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
}

/* ── Controls column vertical spacing ── */
.hook-ctrl-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Drop area inside modal: vertical scroll handling ── */
.hook-modal::-webkit-scrollbar { width: 6px; }
.hook-modal::-webkit-scrollbar-track { background: transparent; }
.hook-modal::-webkit-scrollbar-thumb { background: rgba(160,150,180,0.3); border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hook-modal { padding: 14px; }
}
@media (max-width: 480px) {
  .hook-stats { grid-template-columns: 1fr; }
  .hook-btns { flex-direction: column; }
}